<?php
	/**
	 * Implementation of an HTML-output component.
	 *
	 * Implementation of a basic component for outputting information in HTML.	 
	 *
	 * @author     Brandon R. Stoner <brandon.stoner@gmail.com>
	 * @copyright  Copyright 2008, Monokromatic Inc.
	 * @package    Components
	 * @subpackage Output	 
	 **/

	/**
	 * A very generic output component.
	 *
	 * Basic component for outputting information as HTML.	 	 
	 *	 
	 * @author     Brandon R. Stoner <brandon.stoner@gmail.com>
	 * @copyright  Copyright 2008, Monokromatic Inc.
	 * @package    Components
	 * @subpackage Output
	 **/	 	
	class CKromeOutputHTMLComponent extends IKromeComponent
	{
		/**
		 * Friendly name for this object.
		 * @var string
		 **/
		public  $name = 'Krome Generic Output Component';
		/**
		 * Descriptor for access to stdout.
		 * @var integer
		 **/
		private $fileDescriptor;

		/**
		 * If we have access to stdout, let the component manager know that this
		 * object is able to utilize it.
		 **/
		public function Register()
		{
			$this->RegisterAbility( 'htmloutput' );
		}

		/**
		 * Close our file descriptor, now that we are done writing to it.
		 **/
		public function Cleanup()
		{
		}

		/**
		 * Writes a message to stdout's buffer. Appends a newline if $endl is true.
		 *
		 * @param string $message The message that should be appended to stdout
		 * @param bool   $endl    True if a line feed should be appended to $message
		 * 
		 * @return bool True if the message was successfully written to the buffer
		 **/
		public function Write( $message, $endl = false )
		{
			if ($endl === true)
			{
				$message = $message . "<br />\n";
			}

			print $message;

			return true;
		}
	}
?>
